﻿layui.use(['element', 'layer', 'util', 'form', 'table', 'laydate'], function (exports) {
    var $ = layui.jquery
        , layer = layui.layer
        , element = layui.element //Tab的切换功能，切换事件监听等，需要依赖element模块
        , util = layui.util
        , table = layui.table
        , laydate = layui.laydate;


    /**
     * 刷新时间
     */
    function rfreshTime() {
        // tableFun();
        refreshTable();
    }


    var refreshT = setInterval(rfreshTime, 2000);    //开始定时


    /**
     * 24小时定时刷新
     * 24*60*60=86400
     * @constructor
     */

    function TimeControl() {
        // $(".message_scroll_box").animate({marginTop: 96}, 800,
        //     function () {
        //         $(".message_scroll_box").css({marginTop: 0});    //把顶部的边界清零
        //         $(".message_scroll_box .message_scroll:first").before($(".message_scroll_box .message_scroll:last"));    //在第一个新闻后面插入最后一个新闻
        //
        //     });
        window.location.reload();

    }

    var controlT = setInterval(TimeControl, 86400000);    //开始定时
    // $(".message_scroll_box").mouseenter(function () {
    //     clearInterval(T);    //停止定时
    // })
    //     .mouseleave(function () {
    //         T = setInterval(TimeControl, 2500);    //再次定时
    //     })


    var URL = baseUrl + "/dlssxx/main/daoluxx/roadassetaccount";
    var loading = layer.load(0, {
        shade: false,
        time: 2 * 1000
    });
    $.ajax({
        type: "GET",
        url: URL,
        dataType: "json",
        async: true,
        success: function (result) {
            if (result != null || result != undefined) {
                layer.close(loading);
                var bridgeNum = result.bridgeNum//  桥梁数量
                var roadLength = result.roadLength//道路里程
                var roadNum = result.roadNum//道路数量
                var roadSectionNum = result.roadSectionNum//路段数量
                var tunnelNum = result.tunnelNum//隧道数量
                $('#bridgeNum')[0].innerHTML = bridgeNum + '座';
                $('#roadLength')[0].innerHTML = roadLength + '公里';
                $('#roadNum')[0].innerHTML = roadNum + '条';
                $('#roadSectionNum')[0].innerHTML = roadSectionNum + '条';
                $('#tunnelNum')[0].innerHTML = tunnelNum + '座';
                var ulistArr = '';
                for (var i = 0; i < result.roadIncludeAssets.length; i++) {
                    ulistArr += '<li><img src="img/imag' + result.roadIncludeAssets[i].fAssetClassDictId + '.png">' +
                        '<div class="rDiv">' + result.roadIncludeAssets[i].fClassName + '<div class="blueSpan mt10">' + result.roadIncludeAssets[i].count + '座</div>' +
                        '</div></li>'
                }
                $('.subUl')[0].innerHTML = ulistArr;

                var dataEchart = result.roadSectionGradeMap
                //基础设施

                roadEcahrt(dataEchart);

            }

        },
        // error: function (jqXHR) {
        //     alert("发生错误：" + jqXHR.status);
        // }
    });


    //病害处理
    disFrebug();

    //病害预结算
    disFreSet();
    //设施病害
    facilitFun();

    //病害信息
    informationFun();
    //保障线路
    guaranteeFun();

    //视频监控
    bindvideoSelect();

    //https://entrywuxiroadassetc-vip.app.jtzny.com/dlxy/main/internetofthings/getvideosurveillance?page=1&limit=10
    function bindvideoSelect() {
        $.ajax({
            type: "GET",
            url: baseUrl + "dlxy/main/internetofthings/getvideosurveillance?page=1&limit=10",
            dataType: "json",
            async: true,
            success: function (result) {
                if (result != null || result != undefined) {
                    // layer.close(loading);
                    var _op = "";
                    for (var i = 0; i < result.length; i++) {
                        _op += "<option value='" + result[i].url + "'>" + result[i].vehicleno + "</option>"
                    }
                    $("#videoSelect").append(_op);
                    layui.form.render("select");
                    // diseaseFreSet(result);
                  //  $('#videoSelect').siblings("div.layui-form-select").find('dl').find(select).click();
                    $('.videoIframe').attr('src', result[0].url)

                }

            },
            // error: function (jqXHR) {
            //     alert("发生错误：" + jqXHR.status);
            // }
        });

    }

    //视频监控下拉框监控事件
    layui.form.on('select(videoSelect)', function (data) {
        $('.videoIframe').attr('src', data.value)
    })

    //在岗人员车辆
    personAndCar();

    //https://entrywuxiroadassetc-vip.app.jtzny.com/dlxy/main/internetofthings/getpersonnelandvehicle?PatrolEquipmentType=%E4%BA%BA%E5%91%98
    function personAndCar() {
        //人员
        $.ajax({
            type: "GET",
            url: baseUrl + "dlxy/main/internetofthings/getpersonnelandvehicle?PatrolEquipmentType=%E4%BA%BA%E5%91%98",
            dataType: "json",
            async: true,
            success: function (result) {
                if (result != null || result != undefined) {
                    // layer.close(loading);

                    $('#person')[0].innerHTML = result.length + '人';

                }

            },
            // error: function (jqXHR) {
            //     alert("发生错误：" + jqXHR.status);
            // }
        });
        //车辆
        $.ajax({
            type: "GET",
            url: baseUrl + "dlxy/main/internetofthings/getpersonnelandvehicle?PatrolEquipmentType=%E8%BD%A6%E8%BE%86",
            dataType: "json",
            async: true,
            success: function (result) {
                if (result != null || result != undefined) {
                    // layer.close(loading);

                    $('#car')[0].innerHTML = result.length + '辆';

                }

            },
            // error: function (jqXHR) {
            //     alert("发生错误：" + jqXHR.status);
            // }
        });

    }

    //在线监测

    onlineMonitor();

    layui.form.on('select(onlineSelect)', function (data) {
        var dataArr = data.value.split('&');
        dataArr[0].split('=')[1];
        $('#nomalNum')[0].innerHTML = dataArr[0].split('=')[1] + '个';
        $('#warnNum')[0].innerHTML = dataArr[1].split('=')[1] + '个';
        $('#offlineNum')[0].innerHTML = dataArr[2].split('=')[1] + '个';

    })

    //应急事件
    emergEchart();

    /**
     * 基础设施环状图
     * @param data
     * @param legendData
     */
    function roadEcahrt(data) {

        var itemArr = [];
        for (var i = 0; i < data.countRoad.length; i++) {
            var itemData = [];
            itemData.value = data.countRoad[i];
            itemData.name = data.gradeName[i];
            itemArr.push(itemData);

        }
        var arr = []
        for (var item in itemArr) {
            var obj = {};
            obj.name = itemArr[item].name;
            obj.value = itemArr[item].value;
            arr.push(obj)
        }

        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('roadEcahrt'));


        var colorList = ["#FE8D00","#04BE7A","#D7BD0E", "#D84F0B", "#0194FE", "#03BE79"];

        option = {
            legend: {
                top: '90%',
                itemWidth: 8,
                itemHeight: 8,
                //data: ['a','c','s'],
                textStyle: {
                    color: 'rgba(255,255,255,.5)',
                    fontSize: nowSize(14)
                }
            },
            tooltip: {
                trigger: 'item',
                //   formatter: "{a} <br/>{b}: {c} ({d}%)",
                position: function (p) {   //其中p为当前鼠标的位置
                    return [p[0] + 10, p[1] - 10];
                }
            },
            // backgroundColor:'#000',
            series: [{
                itemStyle: {
                    normal: {
                        color: function (params) {
                            return colorList[params.dataIndex]
                        },
                        borderColor: '#172659',
                        borderWidth: 3
                    }
                },
                type: 'pie',
                //clockWise: false ,
                //roseType: 'radius',
                radius: ['40%', '60%'],
                center: ["50%", "50%"],
                labelLine: {
                    show: false,
                    // normal: {
                    //     lineStyle: {
                    //         color: '#34569D'
                    //     }
                    // }
                },
                label: {
                    show: false,
                    // normal: {
                    //     formatter: params => {
                    //         return (
                    //             '{name|' + params.name + '}{percent|' + params.percent.toFixed(0) + '%}'
                    //         );
                    //     },
                    //     rich: rich,
                    //     padding: [0, -5, 0, -5],
                    // }
                },
                data: arr
            }, {
                itemStyle: {
                    normal: {
                        color: 'rgba(62,109,255,0.4)',
                    }
                },
                type: 'pie',
                hoverAnimation: false,
                radius: ['35%', '65%'],
                center: ["50%", "50%"],
                label: {
                    show: false,
                    normal: {
                        show: false
                    }
                },
                data: [{
                    value: 1,
                }],
                z: -1
            }]
        };

        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
        window.addEventListener("resize", function () {
            myChart.resize();
        });
    }

    //病害信息
    function informationFun() {
        //var startTime = JSON.parse(localStorage.getItem("startTime"));
        //var endTime = JSON.parse(localStorage.getItem("endTime"));
        refreshTable();
    }

    function refreshTable() {

        /**
         * 类型(1: 路段、2:  桥梁、3: 隧道、4: 开挖)
         */
        var tableUrl1 = baseUrl + 'dlxy/main/dzdp/homediseaseinfolist?type=' + 1;
        var tableUrl2 = baseUrl + 'dlxy/main/dzdp/homediseaseinfolist?type=' + 2;
        var tableUrl3 = baseUrl + 'dlxy/main/dzdp/homediseaseinfolist?type=' + 3;
        var tableUrl4 = baseUrl + 'dlxy/main/dzdp/homediseaseinfolist?type=' + 4;

        var roadTable = '#roadTable';
        var bridgeTable = '#bridgeTable';
        var tunnelTable = '#tunnelTable';
        var excavateTable = '#excavateTable';
        /**
         * 类型(井盖: 1001、雨水口: 1002)
         * 1:井盖、2:雨水口
         */

        var urlType1 = baseUrl + 'jcjgl/main/dzdp/homewellorgutterlist';
        var urlType2 = baseUrl + 'roadaccessoryasset/main/bigscreen/homewellorgutterlist';

        var wellTable = '#wellTable';
        var rainTable = '#rainTable';


        ajaxFun(tableUrl1, roadTable);
        ajaxFun(tableUrl2, bridgeTable);
        ajaxFun(tableUrl3, tunnelTable);
        ajaxFun(tableUrl4, excavateTable);

        var flag;
        $.ajax({
            type: "GET",
            url: urlType1 + '?type=1',
            dataType: "json",
            async: true,
            success: function (result) {
                if (result != null || result != undefined) {
                    // layer.close(loading);

                    flag = 1;

                }

            },
            // error: function (jqXHR) {
            //     alert("发生错误：" + jqXHR.status);
            // }
        });

        if (flag == 1) {
            var wellUrl = urlType1 + '?type=1';
            var rainUrl = urlType1 + '?type=2';
            ajaxFun(wellUrl, wellTable);
            ajaxFun(rainUrl, rainTable);

        } else {

            var wellUrl = urlType2 + '?type=1001';
            var rainUrl = urlType2 + '?type=1002';
            ajaxFun(wellUrl, wellTable);
            ajaxFun(rainUrl, rainTable);

        }

        function ajaxFun(url, tableID) {
            var tableData;
            $.ajax({
                type: "GET",
                url: url,
                dataType: "json",
                async: true,
                success: function (result) {
                    if (result != null || result != undefined) {
                        // layer.close(loading);

                        // tableData1 = result;

                        tableData = result.map((item) => {
                            return {
                                diseaseDate: item.diseaseDate,//节点名称
                                binghai: item.category + item.item + item.name,
                                address: item.address,
                                personName: item.personName,
                                status: item.status
                            }
                        }
                    )
                        ;
                        var tableId = tableID;
                        console.log(tableData);
                        tableFun(tableId, tableData);

                    }

                },
                // error: function (jqXHR) {
                //     alert("发生错误：" + jqXHR.status);
                // }
            });

        }

    }

    //病害信息表格

    function tableFun(tableId, obj) {
        /**
         * 类型(1: 路段、2:  桥梁、3: 隧道、4: 开挖)
         */
        table.render({
            elem: tableId
            //, url: baseUrl + 'dlxy/main/dzdp/homediseaseinfolist?type=' + 1
            , parseData: function (res) {
                console.log(res);
                return {
                    "code": 0
                    , "msg": ""
                    , "count": 1000
                    , "data": res
                }
            }
            , cellMinWidth: 100 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
            , height: $('.boxall').height() - 80

            , cols: [[
                {field: 'diseaseDate', title: '时间'}//
                , {field: 'binghai', title: '病害'}
                , {field: 'address', title: '位置'}
                , {field: 'personName', title: '上报人',align:'center'}//
                , {field: 'status', title: '病害状态',align:'center'}

            ]]
            , data: obj
        });

    }

})


//病害处理
function disFrebug() {
    var startTime = JSON.parse(localStorage.getItem("startTime"));
    var endTime = JSON.parse(localStorage.getItem("endTime"));
    $.ajax({
        type: "GET",
        url: baseUrl + "dlssxx/main/diseaseanalysis/getdatabyprocess?startTime=" + startTime + "&endTime=" + endTime,
        dataType: "json",
        async: true,
        success: function (result) {
            if (result != null || result != undefined) {
                // layer.close(loading);

                safeEchart(result);

            }

        },
        // error: function (jqXHR) {
        //     alert("发生错误：" + jqXHR.status);
        // }
    });

}

function safeEchart(data) {
    var itemArr = [];
    for (var i = 0; i < data.name.length; i++) {
        var itemData = [];
        itemData.name = data.name[i];
        itemData.value = data.count[i];
        itemArr.push(itemData);

    }
    var arr = []
    for (var item in itemArr) {
        var obj = {};
        obj.name = itemArr[item].name;
        obj.value = itemArr[item].value;
        arr.push(obj)
    }
    var arr1 = [];
    var arr2 = [];
    var arr3 = [];

    for (var i = 0; i < arr.length; i++) {
        if (arr[i].name == '已录入' || arr[i].name == '已暂存' || arr[i].name == '设施投诉') {
            arr1.push(arr[i]);
            //totalFun(arr1)
            //已录入
        } else if (arr[i].name == '转维修' || arr[i].name == '已退回' || arr[i].name == '已接收' || arr[i].name == '已修复' || arr[i].name == '修復确认' || arr[i].name == '不合格') {
            arr2.push(arr[i]);
            //totalFun(arr2)
            //处理中
        } else if (arr[i].name == '已处理' || arr[i].name == '无效病害' || arr[i].name == '合格' || arr[i].name == '已收方') {
            //已完成
            arr3.push(arr[i]);
            //totalFun(arr3)
        }

    }


    var arr1obj = {};
    arr1obj.name = '已录入';
    arr1obj.value = totalFun(arr1);

    var arr2obj = {};
    arr2obj.name = '处理中';
    arr2obj.value = totalFun(arr2);

    var arr3obj = {};
    arr3obj.name = '已完成';
    arr3obj.value = totalFun(arr3);

    var arrObj = [];
    arrObj.push(arr1obj);
    arrObj.push(arr2obj);
    arrObj.push(arr3obj);

//console.log('打印数据：'+arrObj);
    function totalFun(obj) {
        var arrNum = 0;
        for (var i = 0; i < obj.length; i++) {
            arrNum += obj[i].value;
        }
        return arrNum;
    }

    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById('echartSafe'));

    option = {
        // title: {
        //     text: '某站点用户访问来源',
        //     subtext: '纯属虚构',
        //     left: 'center'
        // },
        tooltip: {
            trigger: 'item',
            formatter: '{a} <br/>{b} : {c} ({d}%)'
        },
        // legend: {
        //     orient: 'vertical',
        //     left: 'left',
        //     data: ['直接访问', '邮件营销', '联盟广告', '视频广告', '搜索引擎']
        // },
        color: ['#F7A35C', '#90EE92', '#7CB5F6', '#12ED93', '#01C2F9', '#3FD0F9'],
        series: [
            {
                name: '访问来源',
                type: 'pie',
                radius: '70%',
                center: ['50%', '60%'],
                data: arrObj,
                emphasis: {
                    itemStyle: {
                        shadowBlur: 10,
                        shadowOffsetX: 0,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                    }
                },
                // label: {
                //     position: 'outer',
                //     alignTo: 'none',
                //     bleedMargin: 15,
                //     fontSize: nowSize(14)
                // },
                label: {
                    normal: {
                        show: true,
                        //formatter: '{c}万元'
                        formatter: '{b}{d}%',
                        fontSize: nowSize(14)

                    },
                }
            }
        ]
    };
    // option = {
    //     // tooltip: {
    //     //     trigger: 'item',
    //     //     formatter: '{a} <br/>{b} : {c} ({d}%)'
    //     // },
    //     color: ['#4962FC', '#189CBF', '#18D070', '#12ED93', '#01C2F9', '#3FD0F9'],
    //     tooltip: {
    //         trigger: 'item',
    //         //   formatter: "{a} <br/>{b}: {c} ({d}%)",
    //         position: function (p) {   //其中p为当前鼠标的位置
    //             return [p[0] + 10, p[1] - 10];
    //         },
    //         formatter: '{a}{b} : {c} ({d}%)'
    //
    //     },
    //     // legend: {
    //     //     x: 'center',
    //     //     y: '15%',
    //     //     //data: ['长沙', '株洲', '湘潭', '衡阳', '邵阳', '岳阳', '常德', '张家界', '益阳', '郴州', '永州', '娄底', '怀化', '湘西'],
    //     //     icon: 'circle',
    //     //     textStyle: {
    //     //         color: '#fff',
    //     //     }
    //     // },
    //     calculable: true,
    //     series: [{
    //         name: '',
    //         type: 'pie',
    //         //起始角度，支持范围[0, 360]
    //         startAngle: 0,
    //         //饼图的半径，数组的第一项是内半径，第二项是外半径
    //         //radius: [41, 280.75],
    //         radius: '50%',
    //         //支持设置成百分比，设置成百分比时第一项是相对于容器宽度，第二项是相对于容器高度
    //         center: ['50%', '50%'],
    //         //是否展示成南丁格尔图，通过半径区分数据大小。可选择两种模式：
    //         // 'radius' 面积展现数据的百分比，半径展现数据的大小。
    //         //  'area' 所有扇区面积相同，仅通过半径展现数据大小
    //         roseType: 'area',
    //         //是否启用防止标签重叠策略，默认开启，圆环图这个例子中需要强制所有标签放在中心位置，可以将该值设为 false。
    //         avoidLabelOverlap: false,
    //         label: {
    //             normal: {
    //                 show: true,
    //                 //formatter: '{c}万元'
    //                 formatter: '{b}{d}%',
    //                 fontSize: nowSize(14)
    //
    //             },
    //             emphasis: {
    //                 //show: true
    //                 itemStyle: {
    //                     shadowBlur: 10,
    //                     shadowOffsetX: 0,
    //                     shadowColor: 'rgba(0, 0, 0, 0.5)'
    //                 }
    //             }
    //         },
    //         labelLine: {
    //             normal: {
    //                 show: true,
    //                 //length2: 1,
    //             },
    //             emphasis: {
    //                 show: true
    //             }
    //         },
    //         data: arrObj
    //
    //     }]
    // };

    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
    window.addEventListener("resize", function () {
        myChart.resize();
    });
}

//病害预结算
function disFreSet() {
    var startTime = JSON.parse(localStorage.getItem("startTime"));
    var endTime = JSON.parse(localStorage.getItem("endTime"));
    $.ajax({
        type: "GET",
        url: baseUrl + "measurecheck/main/presettlementanalysis/getdatabydate?startTime=" + startTime + "&endTime=" + endTime,
        dataType: "json",
        async: true,
        success: function (result) {
            if (result.code == 200) {
                // layer.close(loading);

                diseaseFreSet(result);

            }

        },
        // error: function (jqXHR) {
        //     alert("发生错误：" + jqXHR.status);
        // }
    });

}

function diseaseFreSet(obj) {
    var arr = []
    arr.push(obj.budgetCount);
    arr.push(obj.settleCount);
    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById('echart2'));

    option = {
        //  backgroundColor: '#00265f',
        tooltip: {
            trigger: 'axis',
            axisPointer: {type: 'shadow'}
        },
        grid: {
            left: '0%',
            top: '10px',
            right: '0%',
            bottom: '4%',
            containLabel: true
        },
        xAxis: [{
            type: 'category',
            data: ['预算金额', '结算金额'],
            axisLine: {
                show: true,
                lineStyle: {
                    color: "rgba(255,255,255,.1)",
                    width: 1,
                    type: "solid"
                },
            },

            axisTick: {
                show: false,
            },
            axisLabel: {
                interval: 0,
                // rotate:50,
                show: true,
                splitNumber: 15,
                textStyle: {
                    color: "rgba(255,255,255,.6)",
                    fontSize: '12',
                },
            },
        }],
        yAxis: [{
            type: 'value',
            axisLabel: {
                //formatter: '{value} %'
                show: true,
                textStyle: {
                    color: "rgba(255,255,255,.6)",
                    fontSize: '12',
                },
            },
            axisTick: {
                show: false,
            },
            axisLine: {
                show: true,
                lineStyle: {
                    color: "rgba(255,255,255,.1	)",
                    width: 1,
                    type: "solid"
                },
            },
            splitLine: {
                lineStyle: {
                    color: "rgba(255,255,255,.1)",
                }
            }
        }],
        series: [
            {

                type: 'bar',
                data: arr,
                barWidth: '35%', //柱子宽度
                // barGap: 1, //柱子之间间距
                itemStyle: {
                    normal: {
                        //color: '#27d08a',
                        color: new echarts.graphic.LinearGradient(0, 0, 0, 0.8, [{
                            offset: 0,
                            color: '#25f3e6'
                        }, {
                            offset: 1,
                            color: '#0089ff'
                        }], false),
                        opacity: 1,
                        barBorderRadius: 5,
                    }
                }
            }

        ]
    };

    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
    window.addEventListener("resize", function () {
        myChart.resize();
    });
}

//应急事件
function emergEchart() {
    var arrData;
    var startTime = JSON.parse(localStorage.getItem("startTime"));
    var endTime = JSON.parse(localStorage.getItem("endTime"));
    $.ajax({
        type: "GET",
        url: baseUrl + "yjwzgl/main/emergencyanalysis/getemergencyanalysisdata?warehouseCode=&startTime=" + startTime + "&endTime=" + endTime,
        dataType: "json",
        async: true,
        success: function (result) {
            if (result.code == 200) {
                // layer.close(loading);
                arrData = result.eventStatusList.map((item) => {
                    return {
                        name: item.eventstatus,
                        value: item.count
                    }
                })

                // 基于准备好的dom，初始化echarts实例
                var myChart = echarts.init(document.getElementById('mergEchart'));
                myChart.clear();
                option = {
                    // title: {
                    //     text: '某站点用户访问来源',
                    //     subtext: '纯属虚构',
                    //     left: 'center'
                    // },
                    tooltip: {
                        trigger: 'item',
                        formatter: '{b} : {c}'
                    },
                    // legend: {
                    //     orient: 'vertical',
                    //     left: 'left',
                    //     data: ['直接访问', '邮件营销', '联盟广告', '视频广告', '搜索引擎']
                    // },
                    color: ['#FFDE00', '#00ECD9', '#3FD0F9'],
                    series: [
                        {
                            name: '访问来源',
                            type: 'pie',
                            radius: '75%',
                            center: ['50%', '60%'],
                            data: arrData,
                            emphasis: {
                                itemStyle: {
                                    shadowBlur: 10,
                                    shadowOffsetX: 0,
                                    shadowColor: 'rgba(0, 0, 0, 0.5)'
                                }
                            }
                        }
                    ]
                };

                // 使用刚指定的配置项和数据显示图表。
                myChart.setOption(option);
                window.addEventListener("resize", function () {
                    myChart.resize();
                });

            }

        },

    });

}

//在线监测
function onlineMonitor() {
    var startTime = JSON.parse(localStorage.getItem("startTime"));
    var endTime = JSON.parse(localStorage.getItem("endTime"));
    $.ajax({
        type: "GET",
        // url: baseUrl + "iotmanager/main/checkdata/getcheckdata?startTime="+startTime+"&endTime="+endTime,
        url: 'https://entrywbzy4-vip.app.jtzny.com/iotmanager/main/checkdata/getcheckdata?startTime=2020-09-01&endTime=2020-09-28',

        dataType: "json",
        async: true,
        success: function (result) {
            if (result.code == 200) {
                // layer.close(loading);

                var _op = "<option>请选择</option>";
                for (var i = 0; i < result.roadIncludeAssetList.length; i++) {
                    _op += "<option value='count=" + result.roadIncludeAssetList[i].count + '&warning=' + result.roadIncludeAssetList[i].warning + '&offline=' + result.roadIncludeAssetList[i].offline + "'>" + result.roadIncludeAssetList[i].fname + "</option>"
                }

            }
            _op += "<option value='count=" + result.wellCoverNormal + '&warning=' + result.wellCoverWarning + '&offline=' + result.wellCoverOffLine + "'>井盖</option>";
            _op += "<option value='count=" + result.tunnelNormal + '&warning=' + result.tunnelWarning + '&offline=' + result.tunnelOffLine + "'>隧道</option>";
            _op += "<option value='count=" + result.bridgeNormal + '&warning=' + result.bridgeWarning + '&offline=' + result.bridgeOffLine + "'>桥梁</option>";
            $("#onlineSelect").append(_op);
            layui.form.render("select");

        },
        // error: function (jqXHR) {
        //     alert("发生错误：" + jqXHR.status);
        // }
    });

}

//保障线路
function guaranteeFun() {
    var startTime = JSON.parse(localStorage.getItem("startTime"));
    var endTime = JSON.parse(localStorage.getItem("endTime"));
    $.ajax({
        type: "GET",
        url: baseUrl + "bzxlgl/main/bigscreen/getguaranteelineinfo?startTime=" + startTime + "&endTime=" + endTime,
        dataType: "json",
        async: true,
        success: function (result) {
            if (result != null || result != undefined) {
                // layer.close(loading);
                $('.guarant')[0].innerHTML = result.guaranteeSum + '条';
                $('.damage')[0].innerHTML = result.guaranteeDamageSum + '个';

            }

        },
        // error: function (jqXHR) {
        //     alert("发生错误：" + jqXHR.status);
        // }
    });
}


//设施病害
function facilitFun() {
    var startTime = JSON.parse(localStorage.getItem("startTime"));
    var endTime = JSON.parse(localStorage.getItem("endTime"));
    $.ajax({
        type: "GET",
        url: baseUrl + "dlxy/main/dzdp/homedamagestatistic?startTime=" + startTime + "&endTime=" + endTime,
        dataType: "json",
        async: true,
        success: function (result) {
            if (result != null || result != undefined) {

                // layer.close(loading);
                $('.roadNum')[0].innerHTML = result.roadSectionSum + '个';
                $('.bridgeNum')[0].innerHTML = result.bridgeInfoSum + '个';
                $('.tunelNum')[0].innerHTML = result.tunnelInfoSum + '个';
                $('.excavatNum')[0].innerHTML = result.excavationInfoSum + '个';

            }

        },
        // error: function (jqXHR) {
        //     alert("发生错误：" + jqXHR.status);
        // }
    });

    $.ajax({
        type: "GET",
        url: baseUrl + "jcjgl/main/dzdp/homewellorgutterstatistics?startTime=" + startTime + "&endTime=" + endTime,
        dataType: "json",
        async: true,
        success: function (result) {
            if (result != null || result != undefined) {

                // layer.close(loading);
                $('.wellNum')[0].innerHTML = result.wellLidSum + '个';
                $('.gutterNum')[0].innerHTML = result.gutterSum + '个';

            }

        },
        // error: function (jqXHR) {
        //     alert("发生错误：" + jqXHR.status);
        // }
    });

    $.ajax({
        type: "GET",
        url: baseUrl + "roadaccessoryasset/main/bigscreen/homewellorgutterstatistics?startTime=" + startTime + "&endTime=" + endTime,
        dataType: "json",
        async: true,
        success: function (result) {
            if (result != null || result != undefined) {

                // layer.close(loading);
                $('.wellNum')[0].innerHTML = result.wellLidSum + '个';
                $('.gutterNum')[0].innerHTML = result.gutterSum + '个';

            }

        },
        // error: function (jqXHR) {
        //     alert("发生错误：" + jqXHR.status);
        // }
    });

}

//换算方法
//当前视口宽度
var nowClientWidth = document.documentElement.clientWidth;

function nowSize(val, initWidth = 1920) {
    return val * (nowClientWidth / initWidth);
}














